#include <colormodel.hpp>

//! init global model pointer
RGB    *    RGB::model=0;
GREY   *   GREY::model=0;
YUV    *    YUV::model=0;
XYZ    *    XYZ::model=0;
CieLAB * CieLAB::model=0;

ColorModel::ColorModel() {}

ColorModel::~ColorModel() {}

RGB * RGB::Model()
{
    if( !model)
        model = new RGB();
    return model;
}

void RGB::free()
{
    if(model)
    {
        delete model;
        model    = 0;
    }
}

unsigned int RGB::getChannels() const
{
    return 3;
}

GREY * GREY::Model()
{
    if( !model)
        model = new GREY();
    return model;
}

void GREY::free()
{
    if(model)
    {
        delete model;
        model    = 0;
    }
}

unsigned int GREY::getChannels() const
{
    return 1;
}

YUV * YUV::Model()
{
    if( !model)
        model = new YUV();
    return model;
}

void YUV::free()
{
    if(model)
    {
        delete model;
        model    = 0;
    }
}

unsigned int YUV::getChannels() const
{
    return 3;
}

XYZ * XYZ::Model()
{
    if( !model)
        model = new XYZ();
    return model;
}

void XYZ::free()
{
    if(model)
    {
        delete model;
        model    = 0;
    }
}

unsigned int XYZ::getChannels() const
{
    return 3;
}

CieLAB * CieLAB::Model()
{
    if( !model)
        model = new CieLAB();
    return model;
}

void CieLAB::free()
{
    if(model)
    {
        delete model;
        model    = 0;
    }
}

unsigned int CieLAB::getChannels() const
{
    return 3;
}
